home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / batch / strings2.zip / CAPIT.BAT < prev    next >
DOS Batch File  |  1992-11-05  |  2KB  |  72 lines

  1. @ECHO off
  2. REM ===================================================================
  3. REM
  4. REM Use strings to capitalize the opcodes in an ASM file.
  5. REM
  6. REM ===================================================================
  7.  
  8. REM
  9. REM Use the previous example file PARSE to parse the filename.
  10. REM
  11.  
  12. CALL PARSE %1 ASM
  13.  
  14. IF .%fname%==. GOTO end
  15.  
  16. STRINGS fileout = FILENAME %FNAME%
  17. SET fileout=%FILEOUT%.OUT
  18.  
  19. SET lnum=1
  20.  
  21. REM
  22. REM Read the line to the variable 'LINE'.  If no more lines are in the
  23. REM file, STRINGS will return a nonzero return code.  Pipe the output
  24. REM to the NUL driver to avoid the 'Line not found' error message.
  25. REM
  26. :LABEL1
  27.  
  28. SET line=
  29. SET part1=
  30. SET part2=
  31.  
  32. STRINGS line = READ %FNAME%, %LNUM% > NUL
  33. IF ERRORLEVEL 1 GOTO end
  34.  
  35. REM
  36. REM Find the offset of the ; character in the line.  Don't capitalize
  37. REM characters after the ; since they are part of the comment.
  38. REM
  39.  
  40. STRINGS /p~ offset = FIND ~~%LINE%~ ;
  41. IF .%OFFSET%==.0 SET offset=128
  42.  
  43. STRINGS /p~ part1 = LEFT ~~%LINE%~ %OFFSET%
  44.  
  45. STRINGS offset = ADD %OFFSET%, 1
  46.  
  47. STRINGS /p~ part2 = MID ~~%LINE%~ %OFFSET%~ 128
  48.  
  49. STRINGS /p~ part1 = UPPER ~~%PART1%
  50.  
  51. REM
  52. REM Write the line to the file.  Change the parse character to ~ since
  53. REM the line may contain a comma.  Use double parse characters ~~ to
  54. REM force STRINGS to respect any leading spaces in the parameters.
  55. REM
  56.  
  57. STRINGS /p~ WRITE %FILEOUT%~ ~~%PART1%%PART2% >NUL
  58.  
  59. STRINGS lnum = ADD %LNUM%, 1
  60.  
  61. GOTO label1
  62.  
  63. :END
  64. SET var=
  65. SET fname=
  66. SET fileout=
  67. SET lnum=
  68. SET offset=
  69. SET line=
  70. SET part1=
  71. SET part2=
  72.